/* 基础样式重置与全局设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    outline: none;
    outline-offset: 2px;
    transition: color 0.3s;
}

a:hover {
    color: #ffec00;
}

/* 确保页面占满整个视口高度 */
html, body {
    height: 100%;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 - 使用flex布局确保页脚在底部 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column; /* 垂直排列子元素 */
}

/* 头部样式 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #2c3e50;
    color: white;
}

/* Logo区域样式 - 适配新的图片和文字组合 */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo p {
    font-weight: 600;
    font-size: 1.2rem;
    margin: 0;
}

/* 用户区域样式 - 去掉头像后的调整 */
.user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user span {
    font-weight: 500;
}

header button {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

header button:hover {
    background-color: #c0392b;
}

/* 主内容区域样式 - 自动扩展填充剩余空间 */
main {
    padding: 2rem;
    flex: 1; /* 关键：让主内容区域自动填充剩余空间 */
}

/* 搜索区域样式 */
main label[for="grade-search"] {
    font-weight: 500;
    margin-right: 0.5rem;
    color: #555;
}

main #grade-search {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 300px;
    margin-right: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

main #grade-search:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

main button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin-right: 0.5rem;
}

main button:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

main button:active {
    transform: translateY(1px);
}

main button:nth-of-type(2) {
    background-color: #2ecc71;
}

main button:nth-of-type(2):hover {
    background-color: #27ae60;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

th, td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    position: sticky;
    top: 0;
}

tr:hover {
    background-color: #f9f9f9;
}

tr:nth-child(even) {
    background-color: #f5f5f5;
}

/* 无数据状态样式 */
tr td[colspan="9"] {
    padding: 2rem;
    color: #7f8c8d;
    font-style: italic;
}

/* 成绩单元格特殊样式 */
td:nth-child(7) {
    font-weight: 600;
}

td:nth-child(7):not(:empty):after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

/* 页脚样式 */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 2rem;
    margin-top: auto; /* 确保页脚保持在底部 */
}

.footer-content {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.9;
}

.footer-content p {
    margin: 0.5rem 0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        width: 100%;
    }

    main {
        padding: 1.5rem;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 0.6rem 0.8rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .logo p {
        font-size: 1rem;
    }

    main #grade-search {
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    main {
        padding: 1rem;
    }

    .search-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    main button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    /* 表格在小屏幕上可滚动 */
    .table-wrapper {
        overflow-x: auto;
    }

    /* 无数据状态在小屏幕上的调整 */
    tr td[colspan="9"] {
        padding: 1.5rem 1rem;
    }
}


/* 操作成功结果气泡提示样式 */
.result-tip {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    min-width: 200px;
    padding: 15px 20px;
    border-radius: 8px;
    background-color: #4caf50;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #388e3c;
    animation: slideInRight 0.3s ease-out;
}

/* 操作错误结果气泡提示样式 */
.error-tip {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    min-width: 200px;
    padding: 15px 20px;
    border-radius: 8px;
    background-color: #f44336;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #d32f2f;
    animation: slideInRight 0.3s ease-out;
}

/* 滑入动画 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 个人信息模态框 */
/* 模态框遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* 模态框主体 */
.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 420px;
    max-width: 500px;
    animation: modalFadeIn 0.3s ease-out;
}

/* 模态框内容区域 */
.modal-content {
    border-radius: 12px;
    overflow: hidden;
}

/* 模态框头部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    opacity: 1;
}

/* 模态框主体内容 */
.modal-body {
    padding: 24px;
}

/* 信息行样式 */
.info-row {
    display: flex;
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    width: 100px;
    color: #333;
    font-size: 15px;
}

.info-value {
    flex: 1;
    color: #555;
    font-size: 15px;
}

/* 动画效果 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 修改密码模态框样式 */
#change-password-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#change-password-modal .modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

#change-password-modal .modal-body {
    padding: 24px;
}

#change-password-modal .form-group {
    margin-bottom: 20px;
}

#change-password-modal .form-group:last-child {
    margin-bottom: 0;
}

#change-password-modal label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

#change-password-modal input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#change-password-modal input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

#change-password-modal .modal-footer {
    padding: 20px 24px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

#change-password-modal .btn-primary {
    padding: 10px 20px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#change-password-modal .btn-primary:hover {
    background-color: #5a6fd8;
}

#change-password-modal .btn-secondary {
    padding: 10px 20px;
    background-color: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#change-password-modal .btn-secondary:hover {
    background-color: #e0e0e0;
}
